package com.shqcjd.sinopecdemomobile.ui.adapter;

import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shqcjd.sinopecdemomobile.R;
import com.shqcjd.sinopecdemomobile.model.pojo.AppOperationGuideMode;
import com.shqcjd.sinopecdemomobile.model.pojo.InspectionListBean;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by sy on 2019/5/13.
 */

public class TrajectoryAdapter extends  BaseQuickAdapter<InspectionListBean.ListBean,TrajectoryAdapter.ViewHolder>  {

    public TrajectoryAdapter() {
        super(R.layout.item_trajetor_list);
    }

    @Override
    protected void convert(ViewHolder helper, InspectionListBean.ListBean item) {
        RequestOptions options = new RequestOptions()
                .placeholder(R.mipmap.ic_default_small)	//加载成功之前占位图
                .error(R.mipmap.ic_default_small);	//加载错误之后的错误图
//                .override(87,87);//指定图片的缩放类型为centerCrop （等比例缩放图片，直到图片的宽高都
        Glide.with(mContext)
                .load(item.img)
                .apply(options)
                .into(helper.iv_img);

        helper.tv_title.setText(item.projectName);
        helper.tv_date.setText(item.taskTime);
        helper.addOnClickListener(R.id.tv_trajectory);

    }

    class ViewHolder extends BaseViewHolder {
        @BindView(R.id.iv_img)
        ImageView iv_img;
        @BindView(R.id.tv_title)
        TextView tv_title;
        @BindView(R.id.tv_date)
        TextView tv_date;
        @BindView(R.id.tv_trajectory)
        TextView tv_trajectory;
        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
